using System.Collections;

namespace WGT
{
    public partial class Dialog
    {
        private bool bHorizontal;
        protected int gx;
        private int gxSave;
        protected int gy;
        private int gySave;

        protected void deVerticalShift(int dgx)
        {
            P(() => { gx += dgx; /*gy = 0;*/ });
        }

        protected void deStartHorizontal()
        {
            P(() =>
                  {
                      bHorizontal = true;
                      gxSave = gx;
                      gySave = gy;
                  });
        }

        protected void deEndHorizontal(int h)
        {
            P(() =>
                  {
                      gx = gxSave;
                      gy = gySave + h;
                      bHorizontal = false;
                  });
        }

        public pos pos(int x_, int y_, int w_, int h_)
        {
            return new pos {x = x_, y = y_, w = w_, h = h_};
        }

        public pos Size(int w_, int h_)
        {
            return new pos {x = gx, y = gy, w = w_, h = h_};
        }

        public void Container(string id, string attrs)
        {
            string oattrs = string.Empty;
            GetPut(ref oattrs, ref attrs);

            if (mode == MODE.SHOW)
            {
                U(@"l('{0}');", id);
                //UP(id, attrs);
            }
            else if (mode == MODE.UPDATE)
            {
                //if(oattrs != attrs) UP(id, attrs);
            }
            else if (mode == MODE.ERASE)
            {
                //UP(id, false.ToVisible());
            }
        }

        public void Container(string id)
        {
            Container(id, true.ToVisible());
        }

        public void oReset()
        {
            iOld = 0;
            gx = gy = 0;
            gxSave = gySave = 0;
            bHorizontal = false;
            qN.Clear();
        }

        private void oSwap()
        {
            ArrayList temp = qO;
            qO = qN;
            qN = temp;
            oReset();
        }
    }
}